added Feb 2001 SDK
[windows-sources.git] / shared source / vb / language / shared / contract.h
blobccdbb9b1e5562b2a4716a404b64e7b8ed70d1c2d
1 //-------------------------------------------------------------------------------------------------
2 //
3 // Copyright (c) Microsoft Corporation. All rights reserved.
4 //
5 //-------------------------------------------------------------------------------------------------
7 #pragma once
9 class VBRuntimeException : std::exception
11 public:
12 VBRuntimeException(const wchar_t * pErrorMessage) : m_pErrorMessage(pErrorMessage)
15 private:
16 const wchar_t * m_pErrorMessage;
20 #if DEBUG
21 #define Assume(condition, description) VSASSERT(condition, description)
22 #else
23 #define Assume(condition, description) {if (!(condition)) { throw VBRuntimeException(description); }}
24 #endif // DEBUG
26 #define VBFatal(message) throw VBRuntimeException(message)
27 #define ThrowIfFalse(condition) Assume((condition), L"The condition should not be false! \nPLEASE OPEN A BUG. THIS WILL CAUSE A FATAL EXCEPTION IN RETAIL BUILD!")
28 #define ThrowIfFalse2(condition, msg) Assume((condition), WIDE(msg));
29 #define ThrowIfNull(condition) Assume((condition), L"The condition should not be null! \nPLEASE OPEN A BUG. THIS WILL CAUSE A FATAL EXCEPTION IN RETAIL BUILD!")
30 #define ThrowIfTrue(condition) Assume(!(condition), L"The condition should not be true! \nPLEASE OPEN A BUG. THIS WILL CAUSE A FATAL EXCEPTION IN RETAIL BUILD!")